CC=g++

include ../../../common.mk

BOOST_LIBS=boost_system boost_date_time boost_program_options boost_thread boost_regex boost_random
INCLUDE_PATHS=-I$(BOOST_INCLUDE) -I$(WEBSOCKET_INCLUDE) -I$(JSON_INCLUDE) -I../include
LIB_PATHS=-L$(BOOST_LIB_PATH) -L$(WEBSOCKET_LIB_PATH) -L$(JSON_LIB_PATH) -L..

LIBS=$(BOOST_LIBS:%=-l%) -lConnectionBroker -lwebsocketpp -lConnectionBroker -ljson_linux-gcc-3.4.6_libmt

SRC=\
   server.cpp \
   chat_client.cpp \
   client.cpp \
   sslServer.cpp \
   sslClient.cpp

OBJS=$(patsubst %.cpp,%.o,$(SRC))

all: server.exe chat_client.exe client.exe sslServer.exe sslClient.exe

%.o : %.cpp
	$(CC) $(INCLUDE_PATHS) $(DEBUG) -fPIC -c $^ -o $@

server.exe: server.o 
	$(CC) server.o $(LIB_PATHS) $(DEBUG) $(LIBS) -o server.exe

sslServer.exe: sslServer.o
	$(CC) sslServer.o $(LIB_PATHS) $(DEBUG) $(LIBS) -o sslServer.exe

sslClient.exe: sslClient.o
	$(CC) sslClient.o $(LIB_PATHS) $(DEBUG) $(LIBS) -o sslClient.exe

chat_client.exe: chat_client.o 
	$(CC) chat_client.o $(LIB_PATHS) $(DEBUG) $(LIBS) -o chat_client.exe

client.exe: client.o
	$(CC) client.o $(LIB_PATHS) $(DEBUG) $(LIBS) -o client.exe

clean:
	rm -rf */*/*.o */*.o *.o *.so *.exe
